<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
      xmlns:f="http://xmlns.jcp.org/jsf/core">
<h:head>
    <title>Edit Package</title>
</h:head>

<h:body onload="#{PackageEM.allList()};#{PackageEM.searchById()}">
	<h:form id="main">
	<p:menubar>  
        <p:submenu label="Package Section" >  
            <p:menuitem value="Create Package" url="packageInsertion.xhtml" />  
            <p:menuitem value="All Packages" url="package.xhtml" />  
        </p:submenu>  
  
        <p:submenu label="Hotel Section" >  
            <p:menuitem value="Add Hotel" url="hotelInsert.xhtml" />  
            <p:menuitem value="All Hotel" url="hotel.xhtml" />  
        </p:submenu>  
        
         <p:submenu label="Transportation Section" >  
            <p:menuitem value="Add Transportation" url="transportationInsert.xhtml" />  
            <p:menuitem value="All Transportation" url="transportationMean.xhtml" />  
        </p:submenu>  
        
         <p:submenu label="Excursion Section" >  
            <p:menuitem value="Add Excursion" url="excursionInsert.xhtml" />  
            <p:menuitem value="All Excursion" url="excursion.xhtml" />  
        </p:submenu>  
  
       <f:facet name="options">   
       		<p:commandButton value="Check OutDated Package" action="#{CheckInvalid.checkAll()}"/>
            <p:commandButton value="Logout" action="#{LoginManaged.logout()}"/>
       </f:facet>
    </p:menubar>  
    </h:form>
    <h:form>
	 <p:accordionPanel multiple="true">  
  		
  		<p:tab title="Info">  
            <p:panelGrid columns="3">
				<p:outputLabel value = "Name:"/>
				<p:inplace editor="true">
					<p:inputText id="name" value="#{PackageEM.pDTO.name}" required="true"/>
				</p:inplace>
				<p:message for="name" />
				
				<p:outputLabel value = "Description:"/>
				<p:inplace editor="true">
				<p:inputText id="description" value="#{PackageEM.pDTO.description}" required="true"/>
				</p:inplace>
				<p:message for="description" />
						
				<p:outputLabel value = "Nation:"/>
				<p:inplace editor="true">
				<p:inputText id="nation" value="#{PackageEM.pDTO.nation}" required="true"/>
				</p:inplace>
				<p:message for="nation" />
				
				<p:outputLabel value = "Price:"/>
				<p:inplace editor="true">
				<p:inputText id="price" value="#{PackageEM.pDTO.price}" required="true"/>
				</p:inplace>
				<p:message for="price" />
			</p:panelGrid>
        </p:tab>  
  		
        <p:tab title="Hotel">  
            <h:panelGrid columns="1" cellpadding="10">  
            <p:inplace id="selectableInplaceH" label ="Change Hotel" effectSpeed="fast" event="click">  
            	<p:selectOneListbox value="#{PackageEM.selectedH}" required="true">
   				<f:selectItems value="#{PackageEM.hDTO}" var="h" itemLabel="#{h.name}" itemValue="#{h.id}" />
   				</p:selectOneListbox>
            </p:inplace>	
            </h:panelGrid>  
        </p:tab>  
        
        <p:tab title="Going">  
            <h:panelGrid columns="1" cellpadding="10">  
            <p:inplace id="selectableInplaceG" label ="Change Going" effectSpeed="fast" event="click">
			<p:selectOneListbox value="#{PackageEM.selectedG}" required="true">
   			<f:selectItems value="#{PackageEM.tDTO}" var="t"
   				itemLabel="#{t.company} - #{t.departurePlace} - #{t.arrivalPlace} " itemValue="#{t.id}" />

   			</p:selectOneListbox>
   			</p:inplace> 
            </h:panelGrid>  
        </p:tab>  
        
        <p:tab title="Return">  
            <h:panelGrid columns="2" cellpadding="10">  
            <p:inplace id="selectableInplaceR" label ="Change Return" effectSpeed="fast" event="click">
			<p:selectOneListbox value="#{PackageEM.selectedR}" required="true">
   				<f:selectItems value="#{PackageEM.tDTO}" var="t"
   				itemLabel="#{t.company} - #{t.departurePlace} - #{t.arrivalPlace}" itemValue="#{t.id}" />
   			</p:selectOneListbox>
   			</p:inplace>
            </h:panelGrid>  
        </p:tab>  
        
        <p:tab title="Excursion">  
            <h:panelGrid columns="2" cellpadding="10">  
            <p:inplace id="selectableInplaceE" label ="Change Excursion" effectSpeed="fast" event="click">
			<p:selectOneListbox value="#{PackageEM.selectedE}" >
	   			<f:selectItems value="#{PackageEM.eDTO}" var="e"
	   			itemLabel="#{e.name}" itemValue="#{e.id}" />
	   		</p:selectOneListbox>
	   	</p:inplace>
            </h:panelGrid>  
        </p:tab>  
  
    </p:accordionPanel>  

	<p:commandButton value="Create" action="#{PackageEM.edit()}" ajax="false" />
	<p:messages id="messages" showDetail="true" autoUpdate="true" closable="true" />  
	</h:form>
</h:body>

</html>
